/*
package cn.conac.as.push.entity;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.WebUtils;

*/
/**
 * angularjs默认防xsrf为“XSRF-TOKEN” spring security防XSRF的字段名为“X-CSRF”，
 * 该过滤器将security的X-CSRF复制一份放入angularjs中
 * @author zhangfz
 * @version 1.0
 *//*

public class CsrfHeaderFilter extends OncePerRequestFilter
{
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {
        CsrfToken csrf = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
        if (csrf != null) {
            Cookie cookie = WebUtils.getCookie(request, "XSRF-TOKEN");
            String token = csrf.getToken();
            if (cookie == null || token != null && !token.equals(cookie.getValue())) {
                cookie = new Cookie("XSRF-TOKEN", token);
                cookie.setPath("/");// TODO
                response.addCookie(cookie);
            }
        }
        filterChain.doFilter(request, response);
    }
}*/
